home *** CD-ROM | disk | FTP | other *** search
- #include <graphics.h>
-
- main()
- {
- int graphdriver = DETECT, graphmode;
- char buffer[80];
- int xasp, yasp;
- long xnew;
-
- initgraph(&graphdriver, &graphmode, "c:\\turboc");
-
- /* Get the "aspect ratio." and use it to draw a square */
- getaspectratio( &xasp, &yasp );
- xnew = ( 50L * (long) yasp ) / (long) xasp;
- rectangle( 40, 40, 40+(int) xnew, 40+50 );
- sprintf(buffer,"Aspect ratio: xasp = %d, yasp = %d", xasp, yasp);
- outtextxy(10,10, buffer);
- outtextxy(getmaxx()/2, getmaxy() - 50, "Press any key to exit:");
- getch(); /* Wait until a key is pressed */
- closegraph(); /* Exit graphics library */
- }